<link href="/css/shuaijin.css" rel="stylesheet">
<script src="/js/jquery.min.js"></script>

<div class="car">
<?php
    $pid=$_GET['pid'];
    $key=("key");
   // echo $pid."<br>";
	$curl = curl_init();

	 curl_setopt_array($curl, array(
	//  CURLOPT_URL => "http://apis.haoservice.com/lifeservice/car/GetModel/?id=".$pid."&".$key,
	
	  CURLOPT_URL => "http://apis.haoservice.com/lifeservice/car/GetModel/?id=$pid&key=$key",
	  CURLOPT_RETURNTRANSFER => true,
	  CURLOPT_ENCODING => "",
	  CURLOPT_MAXREDIRS => 10,
	  CURLOPT_TIMEOUT => 30,
	  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	  CURLOPT_CUSTOMREQUEST => "GET",
	));

	$response = curl_exec($curl);
	$err = curl_error($curl);

	curl_close($curl);


	if ($err) {
	  echo "cURL Error #:" . $err;
	  exit;
	} else { //获取到了数据
	  $obj = json_decode($response,true);
	  echo "车系列ID:".$obj['result']['I'];
	  //循环车系列表：obj['result']['List']
	  foreach ($obj['result']['List'] as $key => $value) {
	  	echo "<div class=\"car_body\">";
	  	echo "车型分类ID:". $value['I'].' &nbsp;'; 
	  	echo "<li class=\"car_show\">车型分类名称 : ". $value['N'].' </li>&nbsp;';
	  	
	  	foreach($value['List'] as $k => $value2){
	  		echo "年份 ：". $value2['I'].'<br>';

	  		foreach ($value2['List'] as $m => $value3) {
	  			echo "<div class=\"car_a\">";
		  		echo "车型ID :".$value3['I'].' &nbsp;';
		  		echo "<li>车型名称：" .$value3['N'].'</li> ';
		  		echo "<li>指导价：" .$value3['P'].'</li> ';
		  		echo "<a href=\"/car_body.php?cid=".$value3['I']."\">配置详情</a> &nbsp;";
		  		echo "</div><br>";
	  		}
	  		
	  	
	  		echo "</div>";
	  	}
	  	echo "<br>";
	  	echo "</div>";
	  }

    }


?>
</div>


<script>
/*
$(document).ready(function(){
	$(".car_a").hide();
	$(".car_show").click(function(){
		//alert("11");
	 $(".car_body .car_a").toggle();
	});
});*/
</script>










